package com.optionexplorer.data;

import java.util.Calendar;
import java.util.Date;

/**
 * Filters call options that have < 0 return (deep in the money)
 * and < 1% downside buffer.
 * @author kgajjala
 *
 */
public class DateOptionFilter extends BaseOptionFilter {

	private int _daysOut = 30;
	private Date _maxDate = null;
	
	public void setDaysOut(int num) {
		this._daysOut = num;
		Calendar cal = Calendar.getInstance();
		cal.add(Calendar.DATE,num);
		this._maxDate = cal.getTime();
	}
	
	protected boolean doesQualify(StockOption opt) {
		boolean result = true;
		
		if (opt.getExpirationDate().after(this._maxDate)) {
			result = false;
			return result;
		}
				
		return result;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Calendar cal = Calendar.getInstance();
		cal.add(Calendar.DATE, 150);
		System.out.println("After 30 days : " + cal.getTime());

	}

}
